<?php
/* @var $this yii\web\View */
use app\models\ClassSearchForPerson;
use yii\grid\GridView;

$this->title='课堂考勤记录';
$this->params['breadcrumbs'][] = $this->title;
?>
<h4>课堂考勤记录</h4>

<?php    
    $searchModel = new ClassSearchForPerson($id);
    $dataProvider = $searchModel->search(\Yii::$app->request->queryParams); 
 ?>                  
 <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            'stu_id',
        	'name',
            'year',
            'semester'=>[
             		'attribute'=>'semester',
             		'filter'=>['1'=>'1','2'=>'2'],
             		
    ],
            'time',
             'jieshu',
             'course',
            'teacher',
             'type'=>[
             		'attribute'=>'type',
             		'filter'=>['缺勤'=>'缺勤','迟到'=>'迟到','早退'=>'早退'],
             		
    ],
             'num'=>[
                 'value'=> function($model){
                    $r='次数:'.$model->num;
                    if($model->type=='缺勤')
                        $r='学时数:'.$model->num;
                    return $r;
                 } ,
                 'attribute'=>'num'
             ],

           
        ],
    ]); ?>
